<?php if (!defined('THINK_PATH')) exit(); /*a:3:{s:78:"D:\phpstudy_pro\WWW\shao.gov.cn/application/admin\view\mk\stores\business.html";i:1690708134;s:73:"D:\phpstudy_pro\WWW\shao.gov.cn\application\admin\view\template\base.html";i:1679567630;s:84:"D:\phpstudy_pro\WWW\shao.gov.cn\application\admin\view\template\javascript_vars.html";i:1679567630;}*/ ?>
﻿<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <title><?php echo \think\Config::get('site.title'); ?></title>
    <link rel="Bookmark" href="/favicon.ico" >
    <link rel="Shortcut Icon" href="/favicon.ico" />
    <!--[if lt IE 9]>
    <script type="text/javascript" src="/public/static/admin/lib/html5.js"></script>
    <script type="text/javascript" src="/public/static/admin/lib/respond.min.js"></script>
    <script type="text/javascript" src="/public/static/admin/lib/PIE_IE678.js"></script>
    <![endif]-->
    <link rel="stylesheet" type="text/css" href="/public/static/admin/h-ui/css/H-ui.min.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/h-ui.admin/css/H-ui.admin.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/lib/Hui-iconfont/1.0.7/iconfont.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/lib/icheck/icheck.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/h-ui.admin/skin/default/skin.css" id="skin"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/h-ui.admin/css/style.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/css/app.css"/>
    <link rel="stylesheet" type="text/css" href="/public/static/admin/lib/icheck/icheck.css"/>
    
    <!--[if IE 6]>
    <script type="text/javascript" src="/public/static/admin/lib/DD_belatedPNG_0.0.8a-min.js"></script>
    <script>DD_belatedPNG.fix('*');</script>
    <![endif]-->
    <!--定义JavaScript常量-->
<script>
    window.THINK_ROOT = '<?php echo \think\Request::instance()->root(); ?>';
    window.THINK_MODULE = '<?php echo \think\Url::build("/" . \think\Request::instance()->module(), "", false); ?>';
    window.THINK_CONTROLLER = '<?php echo \think\Url::build("___", "", false); ?>'.replace('/___', '');
</script>
</head>
<body>

<nav class="breadcrumb">
    <div id="nav-title"></div>
    <a class="btn btn-success radius r btn-refresh" style="line-height:1.6em;margin-top:3px" href="javascript:;" title="刷新"><i class="Hui-iconfont"></i></a>
</nav>


<div class="page-container">
    <form method="get" action="<?php echo \think\Url::build(\think\Request::instance()->action()); ?>">
        <h3>
            店铺：<?php echo isset($store['name'])?$store['name']: ''; if(getAdmin()): ?>
            <input type="text" id="store_name" readonly onclick="selectStore()" value="<?php echo getStoreName(\think\Request::instance()->param('store_id')); ?>"  style="width:200px" class="input-text" placeholder="选择店铺">
            <input type="hidden" name="store_id" value="<?php echo \think\Request::instance()->param('store_id'); ?>">
            <button type="submit" class="btn btn-primary radius mr-5"><i class="Hui-iconfont">&#xe665;</i> 搜索</button>
            <?php endif; ?>
        </h3>
    </form>

    <h3>基本信息</h3>
    <form class="form form-horizontal" method="post" action="<?php echo \think\Url::build('businessSave'); ?>" id="form">
        <input type="hidden" name="store_id" value="<?php echo \think\Request::instance()->param('store_id'); ?>">
        <table class="table table-border table-bordered table-hover table-bg mt-20">
            <thead>
            <tr class="text-c">
                <!--<th width="50">序号</th>-->
                <th width="120">模块</th>
                <th>内容</th>
            </tr>
            </thead>
            <tbody>

            <!--<tr class="text-c">
                <td>1</td>
                <td>联系方式</td>
                <td><input name="phone" readonly value="<?php echo isset($store['phone'])?$store['phone']: ''; ?>  (暂不支持商家修改)" class="input-text" type="tel"></td>
            </tr>-->
            <tr class="text-c">
                <!--<td>1</td>-->
                <td>店铺名称</td>
                <td><input name="tag" value="<?php echo isset($store['name'])?$store['name']: ''; ?>" class="input-text" type="text" placeholder="填写店铺名称"></td>
            </tr>
            <tr class="text-c">
                <!--<td>2</td>-->
                <td>店铺地址</td>
                <td style="float:left;">
                    <input type="hidden" name="province" value="<?php echo isset($store['province'])?$store['province']: ''; ?>">
                    <input type="hidden" name="city" value="<?php echo isset($store['city'])?$store['city']: ''; ?>">
                    <input type="hidden" name="area" value="<?php echo isset($store['area'])?$store['area']: ''; ?>">
                    <span class="dropDown"> <a class="dropDown_A" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">选择城市</a>
                    <ul class="dropDown-menu menu radius box-shadow">
                        <?php if(is_array($address) || $address instanceof \think\Collection || $address instanceof \think\Paginator): $i = 0; $__LIST__ = $address;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$first): $mod = ($i % 2 );++$i;?>
                        <li><a href="javascript:;"><?php echo $first['province_name']; ?></a>
                            <?php if(!empty($first['city'])): ?>
                            <ul class="dropDown-menu menu radius box-shadow">

                                <?php if(is_array($first['city']) || $first['city'] instanceof \think\Collection || $first['city'] instanceof \think\Paginator): $i = 0; $__LIST__ = $first['city'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$second): $mod = ($i % 2 );++$i;?>
                                    <li>
                                        <a href="javascript:;"><?php echo $second['city_name']; ?></a>
                                        <?php if(!empty($second['area'])): ?>
                                            <ul class="dropDown-menu menu radius box-shadow">
                                                <?php if(is_array($second['area']) || $second['area'] instanceof \think\Collection || $second['area'] instanceof \think\Paginator): $i = 0; $__LIST__ = $second['area'];if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$third): $mod = ($i % 2 );++$i;?>
                                                <li><a href="javascript:selectAddress('<?php echo $first['province_name']; ?>','<?php echo $second['city_name']; ?>','<?php echo $third; ?>','<?php echo $first['province_name']; ?>/<?php echo $second['city_name']; ?>/<?php echo $third; ?>');"><?php echo $third; ?></a></li>
                                                <?php endforeach; endif; else: echo "" ;endif; ?>
                                            </ul>
                                        <?php endif; ?>
                                        </li>
                                <?php endforeach; endif; else: echo "" ;endif; ?>

                            </ul>
                            <?php endif; ?>
                        </li>
                        <?php endforeach; endif; else: echo "" ;endif; ?>
                    </ul>
                </span>
                    <input type="text" readonly class="input-text" value="<?php echo isset($address_name)?$address_name: ''; ?>" id="sel-address" placeholder="请点击左边按钮选择" datatype="*" nullmsg="请选择地址" style="width: 200px">

                    <input type="text" class="input-text" value="<?php echo isset($store['detailed_address'])?$store['detailed_address']: ''; ?>" placeholder="详情地址" name="detailed_address" style="width: 300px">
                </td>
            </tr>
            <tr class="text-c">
                <!--<td>3</td>-->
                <td>店铺图片</td>
                <td style="text-align: left;padding-left: 30px">
                    <div class="row cl">
                        <div>
                            <input type="text" readonly class="input-text" name="thumb[]" value="<?php echo isset($thumbs[0])?$thumbs[0]: ''; ?>" id="upload" placeholder="请点击后面的上传按钮" datatype="*" nullmsg="请填写图片url" style="width: 300px">
                            <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','<?php echo \think\Url::build('Upload/index', ['id' => 'upload']); ?>')">上传</button>
                            <a onclick="$(this).attr('href', 'http://<?php echo \think\Request::instance()->host(); ?>/public'+$('#upload').val())" type="button" href="" class="btn btn-success radius" data-lightbox="example-1">预览</a>
                            <br/>
                        </div>
                        <div id="up-box">
                            <?php if(is_array($thumbs) || $thumbs instanceof \think\Collection || $thumbs instanceof \think\Paginator): $k = 0; $__LIST__ = $thumbs;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$thumb): $mod = ($k % 2 );++$k;if($k!=1): ?>
                            <div style="margin-top: 5px">
                                <input type="text" readonly class="input-text" name="thumb[]" value="<?php echo isset($thumb)?$thumb: ''; ?>" id="upload<?php echo $k; ?>" placeholder="请点击后面的上传按钮" datatype="*" nullmsg="请填写图片url" style="width: 300px">
                                <button type="button" class="btn btn-primary radius" onclick="layer_open('文件上传','/admin/upload/index/id/upload<?php echo $k; ?>.html')">上传</button>
                                <a onclick="$(this).attr('href', 'http://<?php echo \think\Request::instance()->host(); ?>/public'+$('#upload<?php echo $k; ?>').val())" type="button" href="" class="btn btn-success radius" data-lightbox="example-1">预览</a>
                                <span class="img-del" style="margin-left: 10px;" onclick="$(this).parent('div').remove()">删除</span>
                            </div>
                            <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                        </div>

                        <div style="text-align: right;width: 453px" onclick="addUpImg()">添加</div>
                    </div>
                </td>
            </tr>





            <tr class="text-c">
                <!--<td>4</td>-->
                <td>经营范围</td>
                <td><input name="engage_in" value="<?php echo isset($store['engage_in'])?$store['engage_in']: ''; ?>" class="input-text" type="text" placeholder="木工板 石膏板 木方"></td>
            </tr>


            <tr class="text-c">
                <!--<td>4</td>-->
                <td>店铺标签</td>
                <td><input name="tag" value="<?php echo isset($store['tag'])?$store['tag']: ''; ?>" class="input-text" type="text" placeholder="天利成 五金销售"></td>
            </tr>

            <tr class="text-c">
               <!-- <td>5</td>-->
                <td>店铺介绍</td>
                <td><input name="intro" value="<?php echo isset($store['intro'])?$store['intro']: ''; ?>" class="input-text" type="text" placeholder="生产、销售、安装"></td>
            </tr>
            <tr class="text-c">
                <!--<td></td>-->
                <td>操作</td>
                <td class="f-14" style="text-align: left">
                    <button type="submit" class="btn btn-primary radius mr-5">
                        <i class="Hui-iconfont"></i>保存
                    </button>
                </td>
            </tr>

            </tbody>
        </table>
    </form>

    <h2></h2>

</div>

<script type="text/javascript" src="/public/static/admin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="/public/static/admin/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/public/static/admin/h-ui/js/H-ui.js"></script>
<script type="text/javascript" src="/public/static/admin/h-ui.admin/js/H-ui.admin.js"></script>
<script type="text/javascript" src="/public/static/admin/js/app.js"></script>
<script type="text/javascript" src="/public/static/admin/lib/icheck/jquery.icheck.min.js"></script>

<script type="text/javascript" src="/public/static/admin/lib/Validform/5.3.2/Validform.min.js"></script>
<script>
    $(function () {

        $("#form").Validform({
            tiptype:2,
            ajaxPost:true,
            showAllError:true,
            callback:function(ret){
                if (ret.code){
                    layer.msg("保存失败！");
                } else {
                    layer.msg("保存成功！");
                }
            }
        });
    })
    function selectAddress(fid,sid,tid,str) {
        $('#sel-address').val(str);
        $('input[name=province]').val(fid);
        $('input[name=city]').val(sid);
        $('input[name=area]').val(tid);
    }
    let temp = 0;
    function addUpImg() {
        let imgLen = $('.img-del').length;
        if(imgLen>= 8) return alert("最多能添加9张图片");
        let upload = 'upload'+Math.round(Math.random()*10000)+(temp++);
        let html = "<div style='margin-top: 5px'><input type=\"text\" readonly class=\"input-text\" name=\"thumb[]\" value=\"<?php echo isset($vo['thumb'])?$vo['thumb']: ''; ?>\" id=\""+upload+"\" placeholder=\"请点击后面的上传按钮\" datatype=\"*\" nullmsg=\"请填写图片url\" style=\"width: 300px\">\n" +
            "                        <button type=\"button\" class=\"btn btn-primary radius\" onclick=\"layer_open('文件上传','/admin/upload/index/id/"+upload+".html')\">上传</button>\n" +
            "                        <a onclick=\"$(this).attr('href', 'http://<?php echo \think\Request::instance()->host(); ?>/public'+$('#"+upload+"').val())\" type=\"button\" href=\"\" class=\"btn btn-success radius\" data-lightbox=\"example-1\">预览</a>\n" +
            "                        <span class='img-del' style=\"margin-left: 10px;\" onclick=\"$(this).parent('div').remove()\">删除</span></div>";
        $('#up-box').append(html);
    }
</script>

</body>
</html>